package org.report.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 * @describe 说明
 * @date 2024/5/8 0008 10:35
 */
@Configuration
public class SwaggerConfig {
    @Bean
    public GroupedOpenApi userApi() {
        String[] paths = {"/**"};
        String[] packagedToMatch = {"org.report"};
        return GroupedOpenApi.builder().group("report")
                .pathsToMatch(paths)
                .packagesToScan(packagedToMatch).build();
    }

    @Bean
    public OpenAPI customOpenAPI() {
        Contact contact = new Contact();
        contact.setName("freeman");

        return new OpenAPI().info(new Info()
                .title("报表工具")
                .description("报表工具")
                .contact(contact)
                .version("3.0")
                .termsOfService("https://127.0.0.1:8080")
                .license(new License().name("MIT")
                        .url("https://127.0.0.1")));
    }
}
